In computer graphics applications it is frequently desirable to draw lines, curves and points in three dimensional space that are spatially coincident with a surface in three dimensional space, and which are required to be visible on the surface. Such objects may be characterized as "surface markings," and occur in a wide range of applications.
It has been found that a conventional method of drawing lines, curves and points in a computer graphics system induces inaccuracies. These inaccuracies often result in portions of the surface markings disappearing "behind" the surface and, thus, not being displayed in the desired manner.
FIG. 2 illustrates a representative scene consisting of a triangle, suspended in space, that is to be rendered for display together with a surface marking. In FIG. 2 the surface marking has the form of a line that lies on the surface of the triangle. A standard depth buffer (z-buffer) method for rendering this scene employs an area of memory referred to as an image buffer. The image buffer contains one entry for each display monitor pixel center point (represented by + in FIG. 2). Each entry of the image buffer includes a red, green, and blue (RGB) value representing a color for that pixel, and a depth (z) value to represent the distance, from a viewer or viewplane, of the frontmost object processed thus far for that pixel. Before rendering a scene, each image buffer pixel entry is typically initialized to a specified background color and to a z value representing a greatest possible representable distance from the viewer.
For each object in the scene (for example the triangle and the line in FIG. 2), the set of pixels covered by that object are enumerated. For each pixel, the RGB color of the object, at that pixel's center point, is calculated. For example, the calculation may be made by interpolating the colors at the vertices (PQR) of the triangle or at the endpoints (ST) of the line. Furthermore, a z value representing the distance of the object from the viewer at the pixel center point is calculated. Each computed z value is compared with the z value already stored in the corresponding entry of the image buffer for that pixel, and if the computed z value at the pixel center is closer to the viewer than the z value currently in the image buffer for that pixel, then for that pixel the current object obscures the closest object processed thus far. As a result, the computed RGB color value and the computed z value replace the values currently stored in the image buffer. When all of the objects are thus processed, the image buffer stores RGB and z values that correspond only to points on objects that lie closest to the viewer, and that are not obscured by a "nearer" object.
Generally the z-buffer approach works well. However, when it is applied to surface markings such as lines, curves and points that are coincident with a surface (such as the line and the triangle in FIG. 2), it is observed that a significant proportion of the pixels of the surface marking may be hidden by the surface and, as a result, not displayed.
Similar problems with two coincident surfaces (as opposed to lines, curves and points coincident with a surface) have been observed to be caused by numerical roundoff errors resulting from a limit on the precision of the computer representation of the z values. However, it has further been determined by the inventors that this is not the cause of the problem in the case of surface markings. As a result, methods that have been devised to deal with roundoff errors in the z values do not solve the problem of obscured surface markings. By example, a method that employs toleranced depth tests to overcome roundoff errors is disclosed in commonly assigned U.S. patent application Ser. No. 07/672,058, filed Mar. 12, 1991, entitled "Direct Display of CSG Expression by Use of Depth Buffers" by D. A. Epstein, J. R. Rossignac, and J. W. Wu.
It is thus an object of this invention to provide a method to render surface markings so that a portion or portions of the surface markings are not obscured by the surface which they are intended to mark.